<template>
  <div id="">
<!--    <div style="width:100%;height:40px;">-->
<!--      <el-input clearable @keyup.enter.native="page=1;git_act()" style="width:302px;" placeholder="输入物品名称搜索" v-model="recru" class="input-with-select">-->
<!--        <el-button @click='page=1;git_act()' slot="append" icon="el-icon-search"></el-button>-->
<!--      </el-input>-->
<!--    </div>-->
    <el-table v-loading="loading" :data="tableData"　 stripe style="width:100%;margin-top:20px;">
      <el-table-column header-align='center' align='center' prop="account" label="申请类型" >
        <template slot-scope="scope">{{urlitem}}</template>
      </el-table-column>
      <el-table-column header-align='center' align='center' prop="goodsName" label="物品名称" >
        <template slot-scope="scope">
          {{scope.row.goodsName?scope.row.goodsName:scope.row.name}}
        </template>
      </el-table-column>
      <el-table-column header-align='center' align='center' prop="typeId" label="类型" >
        <template slot-scope="scope">{{id_name(scope.row.typeId,$store.state.user.leidata)}}</template>
      </el-table-column>
      <el-table-column header-align='center' align='center' prop="size" label="尺寸" ></el-table-column>
      <el-table-column header-align='center' align='center' prop="model" label="型号" ></el-table-column>
      <el-table-column header-align='center' align='center' prop="createdTime" label="日期" >
        <template slot-scope="scope"> {{scope.row.doneTime?scope.row.doneTime:scope.row.createdTime}}</template>
      </el-table-column>
      <el-table-column header-align='center' align='center' prop="purpose" label="申请原因" show-overflow-tooltip></el-table-column>
      <el-table-column header-align='center' align='center' prop="phoneNum" label="状态">
        <template slot-scope="scope">
          <a v-if="scope.row.name" :style="{color:(scope.row.reason)?'red':(scope.row.isDone==1?'#67C23A':'#E6A23C')}">{{ (scope.row.reason)?'驳回':(scope.row.isDone==1?'完结':'审核中')}}</a>
          <a v-else :style="{color:(scope.row.isDone)?'#67C23A':'#E6A23C'}" >{{scope.row.isDone?'完结':'审核中'}}</a>
        </template>
      </el-table-column>
      <el-table-column header-align='center' align='center' width="170" label="操作">
        <template slot-scope="scope">
          <el-button class='btn' @click="cgselects(false,scope.row)">详细</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-pagination :current-page='page' v-show='totals>15' style='margin-top:35px;width:100%;text-align: center;'
                   background @size-change="handleSizeChange" @current-change="handleCurrentChange" :page-sizes="ye_s"
                   :page-size="size" layout="total, sizes, prev, pager, next, jumper" :total="totals">
    </el-pagination>
    <applicatinchild :edit="edit" ref="procurmentchild"></applicatinchild>
    <applicationchild2 ref="applicationchild2"></applicationchild2>
  </div>
</template>

<script>
  import applicatinchild from '@/components/MES/applicatin_child.vue'
  import applicationchild2 from '@/components/MES/application_child2.vue'
  import { createdBys,deletes } from '@/api_bast/decla_man'
  export default {
    name: '',
    components: {applicatinchild,applicationchild2},//声明子组件
    data() {
      return {
        edit:true,
        loading:false,
        tableData:[],
        page:1,
        size:15,
        totals:0,
        ye_s:[15,20],
        recru:'',//查询条件
      }
    },
    props:{
       urlitem:String,
    },
    methods: {
      cgselects(bolen,item){
        console.log(item);
        if(item.name){
          this.edit = bolen;
          this.$refs.procurmentchild.panertfn(item);
        }else{
          this.$refs.applicationchild2.panertfn(item);
        }
      },
      // rk(i){//入库申请
      //   this.$confirm('确定将这件物品归还仓库吗？', '提示', {
      //     confirmButtonText: '确定',
      //     cancelButtonText: '取消',
      //     type: 'warning'
      //   }).then(() => {
      //     this.$notify({
      //       title: '成功',
      //       message: '已成功发起入库请求！',
      //       type: 'success'
      //     });
      //
      //   }).catch(() => {});
      // },
      git_act(i){//获取数据列表
        console.log(i)
        this.loading=true;
        let dat= {
          pageNo:this.page,
          pageSize:this.size,
        };
        createdBys(i,this.json_object(this.resData()).id,dat).then(response => {
          this.loading = false;
          if(!response.resData){return false;}
          this.totals = response.resData.total;
          this.tableData = response.resData.list;
        })
      },
      handleCurrentChange(val) {//点击页数
        this.page = val;
        this.git_act();
      },
      handleSizeChange(val) {//点击条数
        this.size = val;
        this.git_act();
      },
    },
    mounted() {

    }
  }
</script>

<style scoped>

</style>
